<%@ page import="java.sql.*,java.io.*" contentType="text/html;charset=windows-1252"%>
<%
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   String url = "jdbc:odbc:iranhk";
   Connection con = DriverManager.getConnection(url, "iranhk", "iranhk");
 
   PreparedStatement pst=con.prepareStatement(
    "select text from tb_articles "+
      "where ID=?;"      
   );
   pst.setString(1,request.getParameter("ID"));
   ResultSet rst=pst.executeQuery();
   /*java.io.InputStream inst=rst.getAsciiStream("text");
   ServletOutputStream outst=response.getOutputStream();
   int r=inst.read();
   while(r!=-1){
    outst.write(r);   
  }*/ 
String txt="";
  try{
    rst.next();
     txt=rst.getString(1);
    out.print(txt);
  }catch(Exception e){
    out.print("im sorry no record found");
  }
//getServletConfig().getServletContext().getRequestDispatcher("/article_files/"+txt).forward(request,response);
response.sendRedirect("../article_files/"+txt);

		
%>
